package org.dromara.common.sms.config

import org.dromara.common.sms.core.dao.PlusSmsDao
import org.dromara.common.sms.handler.SmsExceptionHandler
import org.dromara.sms4j.api.dao.SmsDao
import org.springframework.boot.autoconfigure.AutoConfiguration
import org.springframework.boot.autoconfigure.data.redis.RedisAutoConfiguration
import org.springframework.context.annotation.Bean
import org.springframework.context.annotation.Primary

/**
 * 短信配置类
 *
 * @author LikeYouDo
 * @date 2025/7/17
 */
@AutoConfiguration(after = [RedisAutoConfiguration::class])
class SmsAutoConfiguration {

    @Primary
    @Bean
    fun smsDao(): SmsDao {
        return PlusSmsDao()
    }

    /**
     * 异常处理器
     */
    @Bean
    fun smsExceptionHandler(): SmsExceptionHandler {
        return SmsExceptionHandler()
    }
}
